home *** CD-ROM | disk | FTP | other *** search
/ Chip 2006 July / CHIP 2006-07.2.iso / program / web_gelistirme / easyphp1-7_setup.exe / {app} / phpmyadmin / pdf_pages.php < prev    next >
Encoding:
PHP Script  |  2003-09-07  |  23.5 KB  |  525 lines

  1. <?php
  2. /* $Id: pdf_pages.php,v 1.32 2003/06/25 17:27:28 nijel Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5.  
  6. /**
  7.  * Gets some core libraries
  8.  */
  9. require('./libraries/grab_globals.lib.php');
  10. require('./libraries/common.lib.php');
  11. require('./db_details_common.php');
  12.  
  13.  
  14. /**
  15.  * Settings for relation stuff
  16.  */
  17. require('./libraries/relation.lib.php');
  18. $cfgRelation = PMA_getRelationsParam();
  19.  
  20.  
  21. /**
  22.  * Now in ./libraries/relation.lib.php we check for all tables
  23.  * that we need, but if we don't find them we are quiet about it
  24.  * so people can work without.
  25.  * This page is absolutely useless if you didn't set up your tables
  26.  * correctly, so it is a good place to see which tables we can and
  27.  * complain ;-)
  28.  */
  29. if (!$cfgRelation['relwork']) {
  30.     echo sprintf($strNotSet, 'relation', 'config.inc.php') . '<br />' . "\n"
  31.          . '<a href="./Documentation.html#relation" target="documentation">' . $strDocu . '</a>' . "\n";
  32.     exit();
  33. }
  34.  
  35. if (!$cfgRelation['displaywork']) {
  36.     echo sprintf($strNotSet, 'table_info', 'config.inc.php') . '<br />' . "\n"
  37.          . '<a href="./Documentation.html#table_info" target="documentation">' . $strDocu . '</a>' . "\n";
  38.     exit();
  39. }
  40.  
  41. if (!isset($cfgRelation['table_coords'])){
  42.     echo sprintf($strNotSet, 'table_coords', 'config.inc.php') . '<br />' . "\n"
  43.          . '<a href="./Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>' . "\n";
  44.     exit();
  45. }
  46. if (!isset($cfgRelation['pdf_pages'])) {
  47.     echo sprintf($strNotSet, 'pdf_page', 'config.inc.php') . '<br />' . "\n"
  48.          . '<a href="./Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>' . "\n";
  49.     exit();
  50. }
  51.  
  52. if ($cfgRelation['pdfwork']) {
  53.     // Now is the time to work on all changes
  54.     if (isset($do)) {
  55.         switch ($do) {
  56.             case 'choosepage':
  57.                 if ($action_choose=="1") {
  58.                     $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
  59.                               .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  60.                               .   ' AND   pdf_page_number = ' . $chpage;
  61.                     PMA_query_as_cu($ch_query);
  62.  
  63.                     $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
  64.                               .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  65.                               .   ' AND   page_nr = ' . $chpage;
  66.                     PMA_query_as_cu($ch_query);
  67.  
  68.                     unset($chpage);
  69.                 }
  70.                 break;
  71.             case 'createpage':
  72.                 if (!isset($newpage) || $newpage == '') {
  73.                     $newpage = $strNoDescription;
  74.                 }
  75.                 $ins_query   = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages'])
  76.                              . ' (db_name, page_descr)'
  77.                              . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
  78.                 PMA_query_as_cu($ins_query);
  79.  
  80.                 // A u t o m a t i c    l a y o u t
  81.  
  82.                 if (isset($autolayout)) {
  83.                     // save the page number
  84.                     $pdf_page_number = mysql_insert_id((isset($dbh)?$dbh:''));
  85.  
  86.                     // get the tables that have relations, by descending 
  87.                     // number of links
  88.                     $master_tables = 'SELECT COUNT(master_table), master_table'
  89.                                 . ' FROM ' . PMA_backquote($cfgRelation['relation'])
  90.                                 . ' WHERE master_db = \'' . $db . '\''
  91.                                 . ' GROUP BY master_table'
  92.                                 . ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
  93.                     $master_tables_rs = PMA_query_as_cu($master_tables);
  94.                     if ($master_tables_rs && mysql_num_rows($master_tables_rs) > 0) {
  95.                         // first put all the master tables at beginning
  96.                         // of the list, so they are near the center of
  97.                         // the schema
  98.                         while (list(,$master_table) = mysql_fetch_row($master_tables_rs)) {
  99.                             $all_tables[] = $master_table;
  100.                         }
  101.  
  102.                         // then for each master, add its foreigns into an array
  103.                         // of foreign tables, if not already there
  104.                         // (a foreign might be foreign for more than
  105.                         // one table, and might be a master itself)
  106.  
  107.                         $foreign_tables = array();
  108.                         while (list(,$master_table) = each($all_tables)) {
  109.                             $foreigners = PMA_getForeigners($db, $master_table);
  110.                             while (list(, $foreigner) = each($foreigners)) {
  111.                                 if (!in_array($foreigner['foreign_table'], $foreign_tables)) {
  112.                                     $foreign_tables[] = $foreigner['foreign_table'];
  113.                                 } 
  114.                             } 
  115.                         } 
  116.  
  117.                         // then merge the arrays
  118.  
  119.                         while (list(,$foreign_table) = each($foreign_tables)) {
  120.                             if (!in_array($foreign_table, $all_tables)) {
  121.                                 $all_tables[] = $foreign_table;
  122.                             } 
  123.  
  124.                         }
  125.                         // now generate the coordinates for the schema,
  126.                         // in a clockwise spiral
  127.                        
  128.                         $pos_x = 300;
  129.                         $pos_y = 300;
  130.                         $delta = 50;
  131.                         $delta_mult = 1.34;
  132.                         $direction = "right";
  133.                         reset($all_tables);
  134.  
  135.                         while (list(,$current_table) = each($all_tables)) {
  136.  
  137.                             // save current table's coordinates
  138.                             $insert_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' '
  139.                                           . '(db_name, table_name, pdf_page_number, x, y) '
  140.                                           . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($current_table) . '\',' . $pdf_page_number . ',' . $pos_x . ',' . $pos_y . ')';
  141.                             PMA_query_as_cu($insert_query);
  142.  
  143.  
  144.                             // compute for the next table
  145.                             switch ($direction) {
  146.                                 case 'right':
  147.                                     $pos_x += $delta;
  148.                                     $direction = "down";
  149.                                     $delta *= $delta_mult;
  150.                                     break;
  151.                                 case 'down':
  152.                                     $pos_y += $delta;
  153.                                     $direction = "left";
  154.                                     $delta *= $delta_mult;
  155.                                     break;
  156.                                 case 'left':
  157.                                     $pos_x -= $delta;
  158.                                     $direction = "up";
  159.                                     $delta *= $delta_mult;
  160.                                     break;
  161.                                 case 'up':
  162.                                     $pos_y -= $delta;
  163.                                     $direction = "right";
  164.                                     $delta *= $delta_mult;
  165.                                     break;
  166.                             } // end switch
  167.                         } // end while
  168.                     } // end if there are master tables
  169.  
  170.                     $chpage = $pdf_page_number;
  171.                 } // end if isset autolayout
  172.  
  173.                 break;
  174.  
  175.             case 'edcoord':
  176.                 for ($i = 0; $i < $c_table_rows; $i++) {
  177.                     $arrvalue = 'c_table_' . $i;
  178.                     $arrvalue = $$arrvalue;
  179.                     if (!isset($arrvalue['x']) || $arrvalue['x'] == '') {
  180.                         $arrvalue['x'] = 0;
  181.                     }
  182.                     if (!isset($arrvalue['y']) || $arrvalue['y'] == '') {
  183.                         $arrvalue['y'] = 0;
  184.                     }
  185.                     if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
  186.                         $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
  187.                                     .   ' WHERE db_name = \'' .  PMA_sqlAddslashes($db) . '\''
  188.                                     .   ' AND   table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
  189.                                     .   ' AND   pdf_page_number = ' . $chpage;
  190.                         $test_rs    = PMA_query_as_cu($test_query);
  191.                         if ($test_rs && mysql_num_rows($test_rs) > 0) {
  192.                             if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
  193.                                 $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
  194.                                           .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  195.                                           .   ' AND   table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
  196.                                           .   ' AND   pdf_page_number = ' . $chpage;
  197.                             } else {
  198.                                 $ch_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . ' '
  199.                                           . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
  200.                                           .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  201.                                           .   ' AND   table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
  202.                                           .   ' AND   pdf_page_number = ' . $chpage;
  203.                             }
  204.                         } else {
  205.                             $ch_query     = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' '
  206.                                           . '(db_name, table_name, pdf_page_number, x, y) '
  207.                                           . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
  208.                         }
  209.                         PMA_query_as_cu($ch_query);
  210.                     } // end if
  211.                 } // end for
  212.                 break;
  213.             case 'deleteCrap':
  214.                 while (list(,$current_row) = each($delrow)) {
  215.                     $d_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) . ' ' . "\n"
  216.                              .   ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . "\n"
  217.                              .   ' AND   table_name = \'' . PMA_sqlAddslashes($current_row) . '\'' . "\n"
  218.                              .   ' AND   pdf_page_number = ' . $chpage;
  219.                     PMA_query_as_cu($d_query);
  220.                 }
  221.                 break;
  222.         } // end switch
  223.     } // end if (isset($do))
  224.  
  225.     // We will need an array of all tables in this db
  226.     $selectboxall = array('--');
  227.     $alltab_qry     = 'SHOW TABLES FROM ' . PMA_backquote($db);
  228.     $alltab_rs      = @PMA_mysql_query($alltab_qry) or PMA_mysqlDie('', $alltab_qry, '', $err_url_0);
  229.     while ($val = @PMA_mysql_fetch_array($alltab_rs)) {
  230.         $selectboxall[] = $val[0];
  231.     }
  232.  
  233.  
  234.     // Now first show some possibility to choose a page for the pdf
  235.     $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
  236.                 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
  237.     $page_rs    = PMA_query_as_cu($page_query);
  238.     if ($page_rs && mysql_num_rows($page_rs) > 0) {
  239.         ?>
  240. <form method="get" action="pdf_pages.php" name="selpage">
  241.     <?php echo $strChoosePage . "\n"; ?>
  242.     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  243.     <input type="hidden" name="do" value="choosepage" />
  244.     <select name="chpage" onchange="this.form.submit()">
  245.         <?php
  246.         while ($curr_page = @PMA_mysql_fetch_array($page_rs)) {
  247.             echo "\n" . '        '
  248.                  . '<option value="' . $curr_page['page_nr'] . '"';
  249.             if (isset($chpage) && $chpage == $curr_page['page_nr']) {
  250.                 echo ' selected="selected"';
  251.             }
  252.             echo '>' . $curr_page['page_nr'] . ': ' . $curr_page['page_descr'] . '</option>';
  253.         } // end while
  254.         echo "\n";
  255.         ?>
  256.     </select>
  257.     <input type="radio" name="action_choose" value="0" id="radio_choose0" checked="checked" style="vertical-align: middle" /> <label for="radio_choose0">
  258. <?php echo $strEdit; ?> </label>
  259.     <input type="radio" name="action_choose" value="1" id="radio_choose1"  style="vertical-align: middle" /> <label for="radio_choose1">
  260. <?php echo $strDelete; ?> </label>
  261.  
  262.     <input type="submit" value="<?php echo $strGo; ?>" />
  263. </form>
  264.         <?php
  265.     }
  266.     echo "\n";
  267.  
  268.     // Possibility to create a new page:
  269.     ?>
  270. <form method="post" action="pdf_pages.php" name="crpage">
  271.     <?php echo $strCreatePage . "\n"; ?>
  272.     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  273.     <input type="hidden" name="do" value="createpage" />
  274.     <input type="text" name="newpage" size="20" maxlength="50" />
  275.     <input type="checkbox" name="autolayout" />
  276.     <?php echo '(' . $strAutomaticLayout . ')' . "\n"; ?>
  277.     <input type="submit" value="<?php echo $strGo; ?>" />
  278. </form>
  279.     <?php
  280.     // Now if we already have chosen a page number then we should show the
  281.     // tables involved
  282.     if (isset($chpage) && $chpage > 0) {
  283.         echo "\n";
  284.         ?>
  285. <hr />
  286.  
  287. <h2><?php echo $strSelectTables ;?></h2>
  288.  
  289. <?php
  290. $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
  291.             . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
  292.             . ' AND pdf_page_number = ' . $chpage;
  293. $page_rs    = PMA_query_as_cu($page_query);
  294. $array_sh_page = array();
  295. $draginit = '';
  296. $reset_draginit = '';
  297. $i = 0;
  298. while ($temp_sh_page = @PMA_mysql_fetch_array($page_rs)) {
  299.     $array_sh_page[] = $temp_sh_page;
  300. }
  301. reset($array_sh_page);
  302.  
  303. // garvin: Display WYSIWYG-PDF parts?
  304. if ($cfg['WYSIWYG-PDF']) {
  305. ?>
  306. <script type="text/javascript" src="./libraries/dom-drag.js"></script>
  307. <form method="post" action="pdf_pages.php" name="dragdrop">
  308. <input type="button" name="dragdrop" value="<?php echo $strToggleScratchboard; ?>" onclick="ToggleDragDrop('pdflayout');" />
  309.  <input type="button" name="dragdropreset" value="<?php echo $strReset; ?>" onclick="resetDrag();" />
  310. </form>
  311. <div id="pdflayout" class="pdflayout" style="visibility: hidden;">
  312. <?php
  313. while (list($key, $temp_sh_page) = each($array_sh_page)) {
  314.     $drag_x = $temp_sh_page['x'];
  315.     $drag_y = $temp_sh_page['y'];
  316.     
  317.     $draginit       .= '    Drag.init(getElement("table_' . $i . '"), null, 0, parseInt(myid.style.width)-2, 0, parseInt(myid.style.height)-5);' . "\n";
  318.     $draginit       .= '    getElement("table_' . $i . '").onDrag = function (x, y) { document.edcoord.elements["c_table_' . $i . '[x]"].value = parseInt(x); document.edcoord.elements["c_table_' . $i . '[y]"].value = parseInt(y) }' . "\n";
  319.     $draginit       .= '    getElement("table_' . $i . '").style.left = "' . $drag_x . 'px";' . "\n";
  320.     $draginit       .= '    getElement("table_' . $i . '").style.top  = "' . $drag_y . 'px";' . "\n";
  321.     $reset_draginit .= '    getElement("table_' . $i . '").style.left = "2px";' . "\n";
  322.     $reset_draginit .= '    getElement("table_' . $i . '").style.top  = "' . (15 * $i) . 'px";' . "\n";
  323.     $reset_draginit .= '    document.edcoord.elements["c_table_' . $i . '[x]"].value = "2"' . "\n";
  324.     $reset_draginit .= '    document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n";
  325.  
  326.     echo '<div id="table_' . $i . '" class="pdflayout_table">' . $temp_sh_page['table_name'] . '</div>' . "\n";
  327.     $i++;
  328. }
  329. reset($array_sh_page);
  330. ?>
  331. </div>
  332. <script type="text/javascript">
  333. <!--
  334. function init() {
  335.     refreshLayout();
  336.     myid = getElement('pdflayout');
  337.     <?php echo $draginit; ?>
  338. }
  339.  
  340. function resetDrag() {
  341.     <?php echo $reset_draginit; ?>
  342. }
  343. // -->
  344. </script>
  345. <?php
  346. } // end if WYSIWYG-PDF
  347. ?>
  348.  
  349. <form method="post" action="pdf_pages.php" name="edcoord">
  350.     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  351.     <input type="hidden" name="chpage" value="<?php echo $chpage; ?>" />
  352.     <input type="hidden" name="do" value="edcoord" />
  353.     <table border="0">
  354.     <tr>
  355.         <th><?php echo $strTable; ?></th>
  356.         <th><?php echo $strDelete; ?></th>
  357.         <th>X</th>
  358.         <th>Y</th>
  359.     </tr>
  360.         <?php
  361.         if (isset($ctable)) {
  362.             unset($ctable);
  363.         }
  364.  
  365.  
  366.         $i = 0;
  367.         while (list($dummy_sh_page, $sh_page) = each($array_sh_page)) {
  368.             $_mtab       = $sh_page['table_name'];
  369.             $tabExist[$_mtab] = FALSE;
  370.             echo "\n" . '    <tr ';
  371.             if ($i % 2 == 0) {
  372.                 echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
  373.             } else {
  374.                 echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
  375.             }
  376.             echo '>';
  377.             echo "\n" . '        <td>'
  378.                  . "\n" . '            <select name="c_table_' . $i . '[name]">';
  379.             reset($selectboxall);
  380.             while (list($key, $value) = each($selectboxall)) {
  381.                 echo "\n" . '                <option value="' . $value . '"';
  382.                 if ($value == $sh_page['table_name']) {
  383.                     echo ' selected="selected"';
  384.                     $tabExist[$_mtab] = TRUE;
  385.                 }
  386.                 echo '>' . $value . '</option>';
  387.             } // end while
  388.             echo "\n" . '            </select>'
  389.                  . "\n" . '        </td>';
  390.             echo "\n" . '        <td>'
  391.                  . "\n" . '            <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
  392.             echo "\n" . '        </td>';
  393.             echo "\n" . '        <td>'
  394.                  . "\n" . '            <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'x\', this.value)"' : '') . ' name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
  395.             echo "\n" . '        </td>';
  396.             echo "\n" . '        <td>'
  397.                  . "\n" . '            <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'y\', this.value)"' : '') . ' name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
  398.             echo "\n" . '        </td>';
  399.             echo "\n" . '    </tr>';
  400.             $i++;
  401.         } // end while
  402.         // Do one more empty row
  403.         echo "\n" . '    <tr ';
  404.         if ($i % 2 == 0) {
  405.             echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
  406.         } else {
  407.             echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
  408.         }
  409.         echo '>';
  410.         echo "\n" . '        <td>'
  411.              . "\n" . '            <select name="c_table_' . $i . '[name]">';
  412.         reset($selectboxall);
  413.         while (list($key, $value) = each($selectboxall)) {
  414.             echo "\n" . '                <option value="' . $value . '">' . $value . '</option>';
  415.         }
  416.         echo "\n" . '            </select>'
  417.              . "\n" . '        </td>';
  418.         echo "\n" . '        <td>'
  419.              . "\n" . '            <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
  420.         echo "\n" . '        </td>';
  421.         echo "\n" . '        <td>'
  422.              . "\n" . '            <input type="text" name="c_table_' . $i . '[x]" value="' . (isset($sh_page['x'])?$sh_page['x']:'') . '" />';
  423.         echo "\n" . '        </td>';
  424.         echo "\n" . '        <td>'
  425.              . "\n" . '            <input type="text" name="c_table_' . $i . '[y]" value="' . (isset($sh_page['y'])?$sh_page['y']:'') . '" />';
  426.         echo "\n" . '        </td>';
  427.         echo "\n" . '    </tr>';
  428.         echo "\n" . '    </table>' . "\n";
  429.  
  430.         echo "\n" . '    <input type="hidden" name="c_table_rows" value="' . ($i + 1) . '" />';
  431.         echo ($cfg['WYSIWYG-PDF'] ? "\n" . '    <input type="hidden" name="showwysiwyg" value="' . ((isset($showwysiwyg) && $showwysiwyg == '1') ? '1' : '0') . '" />' : '');
  432.         echo "\n" . '    <input type="submit" value="' . $strGo . '" />';
  433.         echo "\n" . '</form>' . "\n\n";
  434.     } // end if
  435.  
  436.     //  Check if there are tables that need to be deleted,
  437.     //  if there are, ask the user for allowance
  438.     $_strtrans  = '';
  439.     $_strname   = '';
  440.     $shoot      = FALSE;
  441.     if (!empty($tabExist) && is_array($tabExist)) {
  442.         while (list($key, $value) = each($tabExist)) {
  443.             if (!$value) {
  444.                 $_strtrans  .= '<input type="hidden" name="delrow[]" value="' . $key . '">' . "\n";
  445.                 $_strname   .= '<li>' . $key . '</li>' . "\n";
  446.                 $shoot       = TRUE;
  447.             }
  448.         }
  449.         if ($shoot) {
  450.             echo '<FORM action="pdf_pages.php" method="post">' . "\n"
  451.                . PMA_generate_common_hidden_inputs($db, $table)
  452.                . '<input type="hidden" name="do" value="deleteCrap">' . "\n"
  453.                . '<input type="hidden" name="chpage" value="' . $chpage . '">' . "\n"
  454.                . $strDelOld
  455.                . '<ul>' . "\n"
  456.                . $_strname
  457.                . '</ul>' . "\n"
  458.                . $_strtrans
  459.                . '<input type="submit" value="' . $strGo . '">' . "\n"
  460.                . '</FORM>';
  461.         }
  462.     }
  463.     //    ------------------------------------
  464.     //    d i s p l a y   p d f    s c h e m a
  465.     //    ------------------------------------
  466.  
  467.     if (isset($do) 
  468.     && ($do == 'edcoord' 
  469.        || ($do == 'choosepage' && isset($chpage))
  470.        || ($do == 'createpage' && isset($chpage)))) {
  471.         ?>
  472. <form method="post" action="pdf_schema.php" name="pdfoptions">
  473.     <?php echo PMA_generate_common_hidden_inputs($db); ?>
  474.     <input type="hidden" name="pdf_page_number" value="<?php echo $chpage; ?>" />
  475.     <?php echo $strDisplayPDF; ?> :<br />
  476.     <input type="checkbox" name="show_grid" id="show_grid_opt" />
  477.     <label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br />
  478.     <input type="checkbox" name="show_color" id="show_color_opt" checked="checked" />
  479.     <label for="show_color_opt"><?php echo $strShowColor; ?></label><br />
  480.     <input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" />
  481.     <label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?></label><br />
  482.     <input type="checkbox" name="all_tab_same_wide" id="all_tab_same_wide" />
  483.     <label for="all_tab_same_wide"><?php echo $strAllTableSameWidth; ?></label><br />
  484.     <input type="checkbox" name="with_doc" id="with_doc" checked="checked" />
  485.     <label for="with_doc"><?php echo $strDataDict; ?></label> <br />
  486.     <?php echo $strShowDatadictAs; ?>
  487.     <select name="orientation" <?php echo ($cfg['WYSIWYG-PDF'] ? 'onchange="refreshDragOption(\'pdflayout\');"' : ''); ?>>
  488.         <option value="L"><?php echo $strLandscape;?></option>
  489.         <option value="P"><?php echo $strPortrait;?></option>
  490.     </select><br />
  491.     <?php echo $strPaperSize; ?>
  492.     <select name="paper" <?php echo ($cfg['WYSIWYG-PDF'] ? 'onchange="refreshDragOption(\'pdflayout\');"' : ''); ?>>
  493. <?php
  494.     while (list($key,$val) = each($cfg['PDFPageSizes'])) {
  495.         echo '<option value="' . $val . '"';
  496.         if ($val == $cfg['PDFDefaultPageSize']) {
  497.             echo ' selected="selected"';
  498.         }
  499.         echo ' >' . $val . '</option>' . "\n";
  500.     }
  501. ?>
  502.     </select><br />
  503.       <input type="submit" value="<?php echo $strGo; ?>" />
  504. </form>
  505.         <?php
  506.         if ((isset($showwysiwyg) && $showwysiwyg == '1')) {
  507.         ?>
  508. <script type="text/javascript">
  509. <!--
  510. ToggleDragDrop('pdflayout');    
  511. // -->
  512. </script>
  513.         <?php
  514.         }
  515.     } // end if
  516. } // end if ($cfgRelation['pdfwork'])
  517.  
  518.  
  519. /**
  520.  * Displays the footer
  521.  */
  522. echo "\n";
  523. require('./footer.inc.php');
  524. ?>
  525.